/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package interp;
import java.io.BufferedReader;
import com.sun.tools.javac.Main;//use instead. create a .java file - compile and run. just need to translate rows now
//http://www.javaworld.com/javatips/jw-javatip131.html
import m.*;
/**
 *
 * @author Mikael Köhlmyr | mikael@kohlmyr.com | http://www.kmyr.net
 */
public class i20 {
    public i20(){
        BufferedReader br = io.getFileReader(io.getFile("main.bb"));
        // search from top and bottom simultaneously, once reach while or end stop the search on this end.
        // take the portion of the array that hsant been read, send to while.
        // variables defined inside the loop are only local anyway so we can do that.
        //
    }
    
    public String[] findWhileSub(String[] str){
        int i = 0;
        int j = str.length - 1;
        //int half = lang.toInt(Math.ceil(str.length / 2 -1));
        String[] sub;
        boolean[] run = {true, true};
        while(i < str.length){//Not using half because the while could start in the lower half.. And we're breaking when we find it anyway.
            if(str[i].equals("while")){
                run[0] = false;
            }
            else if(run[0]){i++;}
            if(str[j].equals("end")){
                run[1] = false;
            }
            else if(run[1]){j--;}
            if(array.contradiction(run)){break;}
        }
        return str;
    }
}
